package aiku.numericalcontroloa.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.web.bind.annotation.*;

import aiku.numericalcontroloa.Service.getFile.getFileService;

@RestController
@RequestMapping("/files")
public class getFile {

    @Autowired
    private getFileService getFileServiceImp;

    @GetMapping("/word/{fileName}")
    public Resource wordFile(@PathVariable("fileName") String fileName) {
        return getFileServiceImp.getWord(fileName);
    }

    @GetMapping("/excel/{fileName}")
    public Resource excelFile(@PathVariable("fileName") String fileName) {
        return getFileServiceImp.getWord(fileName);
    }

    @GetMapping("/ppt/{fileName}")
    public Resource pptFile(@PathVariable("fileName") String fileName) {
        return getFileServiceImp.getWord(fileName);
    }

    @GetMapping("/pdf/{fileName}")
    public Resource pdfFile(@PathVariable("fileName") String fileName) {
        return getFileServiceImp.getWord(fileName);
    }

    @GetMapping("/weizhi/{fileName}")
    public Resource weizhiFile(@PathVariable("fileName") String fileName) {
        return getFileServiceImp.getWord(fileName);
    }
}
